# Importing Data
GREECE<- read_excel("C:/users/Biniam/Desktop/Documents/Academic/Thesis/Analysis Folder/Excel Files/Aluminium/Aluminium.xlsx",sheet = "Sheet1", range = "O1:O229")

# Checking the Imported Data
View(GREECE)
# Creating Time Series Data
GREECE_ts <- ts(GREECE, start=c(1998,1), end=c(2016,12), frequency=12)
# Viewing and Checking the Created Time Series Data
GREECE_ts
sum(is.na(GREECE_ts))
library(forecast)
GREECE_ts <- tsclean(GREECE_ts)
GREECE_ts

# Identification: Plotting the Time Series Data
plot(GREECE_ts)

# Estimating the appropriate model
GREECE_ts_model <- auto.arima(GREECE_ts)
GREECE_ts_model

# Forecasting
options(max.print=1000000)
GREECE_ts_forecast <- forecast (GREECE_ts_model, level=c(95), h=288)
plot(GREECE_ts_forecast)
GREECE_ts_forecast             

# Exporting
write.table(GREECE_ts_forecast, file="/users/Biniam/Desktop/Documents/Academic/Thesis/Result Folder/TSA Results/Excel Files/From R/Aluminium/GREECE_TSA.csv", sep=",")
